﻿
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Thêm Thành Viên</title>
</head>

<?php include ("../connect.php"); ?>
<?php
if(isset($_POST['txtten_dn'])){
	$ten_dn=$_POST['txtten_dn'];
	//echo $ten_dn;exit;
	$mat_khau=$_POST['txtmk'];
	$email=$_POST['txtemail'];
	$dia_chi=$_POST['txtdia_chi'];
	$so_dt=$_POST['txtso_dt'];
	$quyen=0;
}
?>
<body>
<form name="frmTrolai" method="post" action="../index.php?noidung=dktv" >
<input type="hidden" name="txtten_dn" value="<?php echo $ten_dn; ?>"/>
<input type="hidden" name="txtmk" value="<?php echo $mat_khau; ?>"/>
<input type="hidden" name="txtemail" value="<?php echo $email; ?>"/>
<input type="hidden" name="txtdia_chi" value="<?php echo $dia_chi; ?>"/>
<input type="hidden" name="txtso_dt" value="<?php echo $so_dt; ?>"/>
<input type="hidden" name="txtquyen" value="<?php echo $quyen; ?>"/>

</form>
<?php	
    $sql = "INSERT INTO thanh_vien(TEN_DN,MAT_KHAU,EMAIL,DIA_CHI,SO_DT,MS_QUYEN) 
	                    VALUES('$ten_dn','$mat_khau','$email',N'$dia_chi','$so_dt',$quyen)";
    
					
	$rs=mysql_query($sql);
    if($rs){
		echo "<script>
			alert('Đăng ký thành công...');
		 	location.href='../index.php?noidung=dn';
			</script>";
		exit;
		}else {
		echo "<script>
			alert('Đăng ký thất bại...Vui lòng thử lại sau!');
			document.frmTrolai.submit();
			</script>";
		}
?>
</body>
</html>